clc,clear;
T = 20;  dt = 0.001; t = dt:dt:T; N = size(t,2);  
fs = 1/dt;   ws = fs*2*pi; df = 1/T; dw = 2*pi*df;
s1 = exp(-0.2*t).*sin(2*pi*0.5*t); s2 = exp(-0.1*t).*sin(2*pi*0.6*t);
Us1 = fft(s1); Us2 = fft(s2);
Et11 = sum(s1.*s1)
Ew11 = sum(Us1.*conj(Us1))/N

Et12 = sum(s1.*s2)
Ew12 = sum(Us1.*conj(Us2))/N